<template>
    <section>
        <sy-baselist
                ref="export"
                editVue="./business/Export_Edit.vue"
                :filters="filters"
                listUrl="server/business/Delivery.ashx?cmd=GetList"
                deleteUrl="server/business/Delivery.ashx?cmd=Delete"
                @onLoadRow="onLoadRow"
                :fixWhere="fixWhere"
                :hideAdd="hideAdd"
        >
            <el-table-column prop="FDeliveryNo" label="发货单编号" width="150">
            </el-table-column>
            <el-table-column prop="FDeliveryTime"  header-align="center" label="发货时间"  width="180" >
            </el-table-column>
            <el-table-column prop="FCompany" align="center"  header-align="center" label="购买单位"  width="180" >
            </el-table-column>
            <el-table-column prop="FReceiveUser" align="center"  header-align="center" label="收货人"  width="180" >
            </el-table-column>
            <template  slot="extendbtn_end" scope="props">
                <el-button size="small" v-if="props.row.FApproveStatus==0"  style="margin-left: 0px;" @click="Sure(props.row)">确认</el-button>
                <el-button size="small" v-if="!props.row.hidePrint"  @click="Print(props.row)">打印外销单</el-button>
            </template>
        </sy-baselist>
    </section>
</template>

<script>
    import util from '../../common/util'
    export default {
        data(){
            return {
                dvApprove:false,
                fixWhere:'',
                filters:[],
                hideAdd:false
            }
        },
        methods:{
            onLoadRow(row)
            {
                row.FDeliveryTime = util.date.format(row.FDeliveryTime,'yyyy-MM-dd')
                row.hidePrint=false;
                if(row.FApproveStatus==3)
            {
                row.hideDeleteBtn=true
                row.editTitle='查看'
            }
            },
            init(){
                    this.fixWhere='FType=1'
                    this.hideAdd=false

                this.filters=[{type: "string",name:"FDeliveryNo",text:"发货单编号", value: ""},
                    {type: "date",name:"FDeliveryTime",text:"发货时间", value: null}]
            },
            Print(row){
                window.open(global.serverHost+"client/print/printexport.html?FID="+row.FID);
            },
            Sure(row){
                util.post("server/business/Delivery.ashx?cmd=Sure",row,this.switchLoading,result=> {
                    util.msgSuc("确认成功")
                    this.$refs.export._refrash()
                })
            }
        },
        watch: {
            '$route' (to, from) {
                // 对路由变化作出响应...
                this.init()
            }
        },
        created(){
            this.init()
        }
    }
</script>